\rcube_imap

Interface class for accessing an IMAP server

Summary

Methods
Properties
Constants
connect()
close()
is_connected()
check_connection()
get_error_code()
get_error_str()
get_response_code()
set_options()
get_option()
set_debug()
set_charset()
set_folder()
get_folder()
set_page()
get_page()
set_pagesize()
get_pagesize()
set_search_set()
get_search_set()
get_capability()
set_threading()
get_threading()
check_permflag()
get_hierarchy_delimiter()
get_namespace()
count()
list_flags()
list_messages()
index()
search()
search_once()
refresh_search()
get_message()
get_message_headers()
get_message_part()
get_body()
get_raw_body()
get_raw_headers()
print_raw_body()
set_flag()
unset_flag()
save_message()
move_message()
copy_message()
delete_message()
expunge_message()
list_folders_subscribed()
list_folders()
subscribe()
unsubscribe()
create_folder()
rename_folder()
delete_folder()
expunge_folder()
clear_folder()
folder_exists()
folder_size()
folder_namespace()
folder_attributes()
folder_data()
folder_info()
folder_status()
folder_sync()
mod_folder()
folder_validate()
create_default_folders()
is_special_folder()
get_special_folders()
set_special_folders()
get_quota()
set_acl()
delete_acl()
get_acl()
list_rights()
my_rights()
set_metadata()
delete_metadata()
get_metadata()
clear_cache()
get_cache()
cache_gc()
__construct()
__get()
get_permflags()
get_vendor()
threads()
threads_direct()
fetch_headers()
index_direct()
thread_index()
convert_criteria()
list_folders_subscribed_direct()
list_folders_direct()
set_caching()
update_cache()
set_messages_caching()
sort_folder_list()
id2uid()
debug_handler()
$conn
$folder_types
UNKNOWN
NOPERM
READONLY
TRYCREATE
INUSE
OVERQUOTA
ALREADYEXISTS
NONEXISTENT
CONTACTADMIN
DUAL_USE_FOLDERS
parse_uids()
set_env()
countmessages()
_list_messages()
list_thread_messages()
fetch_thread_headers()
set_thread_flags()
list_search_messages()
list_search_thread_messages()
set_folder_stats()
get_folder_stats()
sort_threads()
search_index()
set_search_dirty()
structure_part()
set_part_filename()
structure_charset()
list_folders_filter()
list_folders_update()
filter_rights()
get_fetch_headers()
md2annotate()
get_cache_engine()
get_mcache_engine()
clear_message_cache()
detect_dual_use_folders()
set_sort_order()
sort_folder_specials()
sort_folder_comparator()
change_subscription()
set_messagecount()
clear_messagecount()
date_format()
save_conn_state()
restore_conn_state()
$folder
$default_charset
$options
$page_size
$list_page
$threading
$search_set
$icache
$all_headers
$mcache
$cache
$plugins
$delimiter
$namespace
$struct_charset
$search_string
$search_charset
$search_sort_field
$search_threads
$search_sorted
$sort_field
$sort_order
$caching
$messages_caching
$connect_done
$list_excludes
$list_root
$msg_uid
$sort_folder_collator
N/A
No private methods found
No private properties found
N/A

Constants

UNKNOWN

UNKNOWN = 0

NOPERM

NOPERM = 1

READONLY

READONLY = 2

TRYCREATE

TRYCREATE = 3

INUSE

INUSE = 4

OVERQUOTA

OVERQUOTA = 5

ALREADYEXISTS

ALREADYEXISTS = 6

NONEXISTENT

NONEXISTENT = 7

CONTACTADMIN

CONTACTADMIN = 8

DUAL_USE_FOLDERS

DUAL_USE_FOLDERS = 'X-DUAL-USE-FOLDERS'

Properties

$conn

$conn : \rcube_imap_generic

Instance of rcube_imap_generic

Type

rcube_imap_generic

$folder_types

$folder_types : array

List of supported special folder types

Type

array

$folder

$folder

$default_charset

$default_charset

$options

$options

$page_size

$page_size

$list_page

$list_page

$threading

$threading

$search_set

$search_set

$icache

$icache : array

Internal (in-memory) cache

Type

array

$all_headers

$all_headers : array

All (additional) headers used (in any way) by Roundcube Not listed here: DATE, FROM, TO, CC, REPLY-TO, SUBJECT, CONTENT-TYPE, LIST-POST (used for messages listing) are hardcoded in rcube_imap_generic::fetchHeaders()

Type

array

$mcache

$mcache : \rcube_imap_cache

Instance of rcube_imap_cache

Type

rcube_imap_cache

$cache

$cache : \rcube_cache

Instance of rcube_cache

Type

rcube_cache

$plugins

$plugins

$delimiter

$delimiter

$namespace

$namespace

$struct_charset

$struct_charset

$search_string

$search_string

$search_charset

$search_charset

$search_sort_field

$search_sort_field

$search_threads

$search_threads

$search_sorted

$search_sorted

$sort_field

$sort_field

$sort_order

$sort_order

$caching

$caching

$messages_caching

$messages_caching

$connect_done

$connect_done

$list_excludes

$list_excludes

$list_root

$list_root

$msg_uid

$msg_uid

$sort_folder_collator

$sort_folder_collator

Methods

connect()

connect(string  $host, string  $user, string  $pass, int  $port = 143, string  $use_ssl = null) : bool

Connect to an IMAP server

Parameters

string $host

Host to connect

string $user

Username for IMAP account

string $pass

Password for IMAP account

int $port

Port to connect to

string $use_ssl

SSL schema (either ssl or tls) or null if plain connection

Returns

bool —

True on success, False on failure

close()

close() : mixed

Close IMAP connection.

Usually done on script shutdown

Returns

mixed —

is_connected()

is_connected() : bool

Checks IMAP connection.

Returns

bool —

True on success, False on failure

check_connection()

check_connection() : bool

Check connection state, connect if not connected.

Returns

bool —

Connection state.

get_error_code()

get_error_code() : int

Returns code of last error

Returns

int —

Error code

get_error_str()

get_error_str() : string

Returns text of last error

Returns

string —

Error string

get_response_code()

get_response_code() : int

Returns code of last command response

Returns

int —

Response code

set_options()

set_options(array  $opt) : mixed

Set connection and class options

Parameters

array $opt

Options array

Returns

mixed —

get_option()

get_option(string  $name) : mixed

Get connection/class option

Parameters

string $name

Option name

Returns

mixed —

set_debug()

set_debug(bool  $dbg = true) : mixed

Activate/deactivate debug mode

Parameters

bool $dbg

True if IMAP conversation should be logged

Returns

mixed —

set_charset()

set_charset(string  $cs) : mixed

Set default message charset.

This will be used for message decoding if a charset specification is not available

Parameters

string $cs

Charset string

Returns

mixed —

set_folder()

set_folder(string  $folder) : mixed

Set internal folder reference.

All operations will be performed on this folder.

Parameters

string $folder

Folder name

Returns

mixed —

get_folder()

get_folder() : string

Returns the currently used folder name

Returns

string —

Name of the folder

set_page()

set_page(int  $page) : mixed

Set internal list page number.

Parameters

int $page

Page number to list

Returns

mixed —

get_page()

get_page() : int

Gets internal list page number.

Returns

int —

Page number

set_pagesize()

set_pagesize(int  $size) : mixed

Set internal page size

Parameters

int $size

Number of messages to display on one page

Returns

mixed —

get_pagesize()

get_pagesize() : int

Get internal page size

Returns

int —

Number of messages to display on one page

set_search_set()

set_search_set(array  $set) : mixed

Save a search result for future message listing methods

Parameters

array $set

Search set, result from rcube_imap::get_search_set(): 0 - searching criteria, string 1 - search result, rcube_result_index|rcube_result_thread 2 - searching character set, string 3 - sorting field, string 4 - true if sorted, bool

Returns

mixed —

get_search_set()

get_search_set() : array|null

Return the saved search set as hash array

Returns

array|null —

Search set

get_capability()

get_capability(string  $cap) : mixed

Returns the IMAP server's capability.

Parameters

string $cap

Capability name

Returns

mixed —

Capability value or TRUE if supported, FALSE if not

set_threading()

set_threading(bool  $enable = false) : mixed

Sets threading flag to the best supported THREAD algorithm.

Enable/Disable threaded mode.

Parameters

bool $enable

True to enable threading

Returns

mixed —

Threading algorithm or False if THREAD is not supported

get_threading()

get_threading() : mixed

Get current threading flag.

Returns

mixed —

Threading algorithm or False if THREAD is not supported or disabled

check_permflag()

check_permflag(string  $flag) : bool

Checks the PERMANENTFLAGS capability of the current folder and returns true if the given flag is supported by the IMAP server

Parameters

string $flag

Permanentflag name

Returns

bool —

True if this flag is supported

get_hierarchy_delimiter()

get_hierarchy_delimiter() : string

Returns the delimiter that is used by the IMAP server for folder separation

Returns

string —

Delimiter string

get_namespace()

get_namespace(string  $name = null) : array

Get namespace

Parameters

string $name

Namespace array index: personal, other, shared, prefix

Returns

array —

Namespace data

count()

count(string  $folder = '', string  $mode = 'ALL', bool  $force = false, bool  $status = true) : int

Get message count for a specific folder

Parameters

string $folder

Folder name

string $mode

Mode for count [ALL|THREADS|UNSEEN|RECENT|EXISTS]

bool $force

Force reading from server and update cache

bool $status

Enables storing folder status info (max UID/count), required for folder_status()

Returns

int —

Number of messages

list_flags()

list_flags(string  $folder, array  $uids, int  $mod_seq = null) : array

Public method for listing message flags

Parameters

string $folder

Folder name

array $uids

Message UIDs

int $mod_seq

Optional MODSEQ value (of last flag update)

Returns

array —

Indexed array with message flags

list_messages()

list_messages(string  $folder = '', int  $page = null, string  $sort_field = null, string  $sort_order = null, int  $slice) : array

Public method for listing headers

Parameters

string $folder

Folder name

int $page

Current page to list

string $sort_field

Header field to sort by

string $sort_order

Sort order [ASC|DESC]

int $slice

Number of slice items to extract from result array

Returns

array —

Indexed array with message header objects

index()

index(string  $folder = '', string  $sort_field = null, string  $sort_order = null, bool  $no_threads = false, bool  $no_search = false) : \rcube_result_index|\rcube_result_thread

Return sorted list of message UIDs

Parameters

string $folder

Folder to get index from

string $sort_field

Sort column

string $sort_order

Sort order [ASC, DESC]

bool $no_threads

Get not threaded index

bool $no_search

Get index not limited to search result (optionally)

Returns

\rcube_result_index|\rcube_result_thread —

List of messages (UIDs)

search()

search(string  $folder = '', string  $search = 'ALL', string  $charset = null, string  $sort_field = null) : \rcube_result_index

Invoke search request to IMAP server

Parameters

string $folder

Folder name to search in

string $search

Search criteria

string $charset

Search charset

string $sort_field

Header field to sort by

Returns

\rcube_result_index —

Search result object

search_once()

search_once(mixed  $folder = null, string  $str = 'ALL') : \rcube_result_index

Direct (real and simple) SEARCH request (without result sorting and caching).

Parameters

mixed $folder

Folder name to search in

string $str

Search string

Returns

\rcube_result_index —

Search result (UIDs)

refresh_search()

refresh_search() : array

Refresh saved search set

Returns

array —

Current search set

get_message()

get_message(int  $uid, string  $folder = null) : object

Fetch message headers and body structure from the IMAP server and build an object structure.

Parameters

int $uid

Message UID to fetch

string $folder

Folder to read from

Returns

object —

rcube_message_header Message data

get_message_headers()

get_message_headers(mixed  $uid, string  $folder = null, bool  $force = false) : \rcube_message_header

Return message headers object of a specific message

Parameters

mixed $uid
string $folder

Folder to read from

bool $force

True to skip cache

Returns

\rcube_message_header —

Message headers

get_message_part()

get_message_part(int  $uid, string  $part = 1, \rcube_message_part  $o_part = null, mixed  $print = null, resource  $fp = null, bool  $skip_charset_conv = false, int  $max_bytes, bool  $formatted = true) : string

Fetch message body of a specific message from the server

Parameters

int $uid

Message UID

string $part

Part number

\rcube_message_part $o_part

Part object created by get_structure()

mixed $print

True to print part, resource to write part contents in

resource $fp

File pointer to save the message part

bool $skip_charset_conv

Disables charset conversion

int $max_bytes

Only read this number of bytes

bool $formatted

Enables formatting of text/* parts bodies

Returns

string —

Message/part body if not printed

get_body()

get_body(int  $uid, mixed  $part = 1) : string

Fetch message body of a specific message from the server

Parameters

int $uid

Message UID

mixed $part

Returns

string —

$part Message/part body

get_raw_body()

get_raw_body(int  $uid, resource  $fp = null, string  $part = null) : string

Returns the whole message source as string (or saves to a file)

Parameters

int $uid

Message UID

resource $fp

File pointer to save the message

string $part

Optional message part ID

Returns

string —

Message source string

get_raw_headers()

get_raw_headers(int  $uid, string  $part = null) : string

Returns the message headers as string

Parameters

int $uid

Message UID

string $part

Optional message part ID

Returns

string —

Message headers string

print_raw_body()

print_raw_body(int  $uid, bool  $formatted = true) : mixed

Sends the whole message source to stdout

Parameters

int $uid

Message UID

bool $formatted

Enables line-ending formatting

Returns

mixed —

set_flag()

set_flag(mixed  $uids, string  $flag, string  $folder = null, bool  $skip_cache = false) : bool

Set message flag to one or several messages

Parameters

mixed $uids

Message UIDs as array or comma-separated string, or '*'

string $flag

Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT

string $folder

Folder name

bool $skip_cache

True to skip message cache clean up

Returns

bool —

Operation status

unset_flag()

unset_flag(mixed  $uids, string  $flag, string  $folder = null) : bool

Remove message flag for one or several messages

Parameters

mixed $uids

Message UIDs as array or comma-separated string, or '*'

string $flag

Flag to unset: SEEN, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT

string $folder

Folder name

Returns

bool —

Operation status

save_message()

save_message(string  $folder, string|array  $message, string  $headers = '', bool  $is_file = false, array  $flags = [], mixed  $date = null, bool  $binary = false) : int|bool

Append a mail message (source) to a specific folder

Parameters

string $folder

Target folder

string|array $message

The message source string or filename or array (of strings and file pointers)

string $headers

Headers string if $message contains only the body

bool $is_file

True if $message is a filename

array $flags

Message flags

mixed $date

Message internal date

bool $binary

Enables BINARY append

Returns

int|bool —

Appended message UID or True on success, False on error

move_message()

move_message(mixed  $uids, string  $to_mbox, string  $from_mbox = '') : bool

Move a message from one folder to another

Parameters

mixed $uids

Message UIDs as array or comma-separated string, or '*'

string $to_mbox

Target folder

string $from_mbox

Source folder

Returns

bool —

True on success, False on error

copy_message()

copy_message(mixed  $uids, string  $to_mbox, string  $from_mbox = '') : bool

Copy a message from one folder to another

Parameters

mixed $uids

Message UIDs as array or comma-separated string, or '*'

string $to_mbox

Target folder

string $from_mbox

Source folder

Returns

bool —

True on success, False on error

delete_message()

delete_message(mixed  $uids, string  $folder = '') : bool

Mark messages as deleted and expunge them

Parameters

mixed $uids

Message UIDs as array or comma-separated string, or '*'

string $folder

Source folder

Returns

bool —

True on success, False on error

expunge_message()

expunge_message(mixed  $uids, string  $folder = null, bool  $clear_cache = true) : bool

Send IMAP expunge command and clear cache

Parameters

mixed $uids

Message UIDs as array or comma-separated string, or '*'

string $folder

Folder name

bool $clear_cache

False if cache should not be cleared

Returns

bool —

True on success, False on failure

list_folders_subscribed()

list_folders_subscribed(string  $root = '', string  $name = '*', string  $filter = null, string  $rights = null, bool  $skip_sort = false) : array

Public method for listing subscribed folders.

Parameters

string $root

Optional root folder

string $name

Optional name pattern

string $filter

Optional filter

string $rights

Optional ACL requirements

bool $skip_sort

Enable to return unsorted list (for better performance)

Returns

array —

List of folders

list_folders()

list_folders(string  $root = '', string  $name = '*', mixed  $filter = null, string  $rights = null, bool  $skip_sort = false) : array

Get a list of all folders available on the server

Parameters

string $root

IMAP root dir

string $name

Optional name pattern

mixed $filter

Optional filter

string $rights

Optional ACL requirements

bool $skip_sort

Enable to return unsorted list (for better performance)

Returns

array —

Indexed array with folder names

subscribe()

subscribe(array  $folders) : bool

Subscribe to a specific folder(s)

Parameters

array $folders

Folder name(s)

Returns

bool —

True on success, False on failure

unsubscribe()

unsubscribe(mixed  $folders) : bool

Unsubscribe folder(s)

Parameters

mixed $folders

Folder name(s)

Returns

bool —

True on success, False on failure

create_folder()

create_folder(string  $folder, bool  $subscribe = false, string  $type = null, bool  $noselect = false) : bool

Create a new folder on the server and register it in local cache

Parameters

string $folder

New folder name

bool $subscribe

True if the new folder should be subscribed

string $type

Optional folder type (junk, trash, drafts, sent, archive)

bool $noselect

Make the folder a \NoSelect folder by adding hierarchy separator at the end (useful for server that do not support both folders and messages as folder children)

Returns

bool —

True on success, False on failure

rename_folder()

rename_folder(string  $folder, string  $new_name) : bool

Set a new name to an existing folder

Parameters

string $folder

Folder to rename

string $new_name

New folder name

Returns

bool —

True on success, False on failure

delete_folder()

delete_folder(string  $folder) : bool

Remove folder (with subfolders) from the server

Parameters

string $folder

Folder name

Returns

bool —

True on success, False on failure

expunge_folder()

expunge_folder(string  $folder = null, bool  $clear_cache = true) : bool

Send expunge command and clear the cache.

Parameters

string $folder

Folder name

bool $clear_cache

False if cache should not be cleared

Returns

bool —

True on success, False on error

clear_folder()

clear_folder(string  $folder = null) : bool

Remove all messages in a folder.

.

Parameters

string $folder

Folder name

Returns

bool —

True on success, False on error

folder_exists()

folder_exists(string  $folder, bool  $subscription = false) : bool

Checks if folder exists and is subscribed

Parameters

string $folder

Folder name

bool $subscription

Enable subscription checking

Returns

bool —

True or False

folder_size()

folder_size(string  $folder) : int

Get folder size (size of all messages in a folder)

Parameters

string $folder

Folder name

Returns

int —

Folder size in bytes, False on error

folder_namespace()

folder_namespace(string  $folder) : string

Returns the namespace where the folder is in

Parameters

string $folder

Folder name

Returns

string —

One of 'personal', 'other' or 'shared'

folder_attributes()

folder_attributes(string  $folder, bool  $force = false) : array

Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors

Parameters

string $folder

Folder name

bool $force

Set to True if attributes should be refreshed

Returns

array —

Options list

folder_data()

folder_data(string  $folder) : array

Gets connection (and current folder) data: UIDVALIDITY, EXISTS, RECENT, PERMANENTFLAGS, UIDNEXT, UNSEEN

Parameters

string $folder

Folder name

Returns

array —

Data

folder_info()

folder_info(string  $folder) : array

Returns extended information about the folder

Parameters

string $folder

Folder name

Returns

array —

Data

folder_status()

folder_status(string  $folder = null, array  $diff = []) : int

Returns current status of a folder (compared to the last time use)

We compare the maximum UID to determine the number of new messages because the RECENT flag is not reliable.

Parameters

string $folder

Folder name

array $diff

Difference data

Returns

int —

Folder status

folder_sync()

folder_sync(string  $folder) : mixed

Synchronizes messages cache.

Parameters

string $folder

Folder name

Returns

mixed —

mod_folder()

mod_folder(string  $folder, string  $mode = 'out') : string

Modify folder name according to personal namespace prefix.

For output it removes prefix of the personal namespace if it's possible. For input it adds the prefix. Use it before creating a folder in root of the folders tree.

Parameters

string $folder

Folder name

string $mode

Mode name (out/in)

Returns

string —

Folder name

folder_validate()

folder_validate(string  $folder, string  $char = null) : bool

Check if the folder name is valid

Parameters

string $folder

Folder name (UTF-8)

string $char

First forbidden character found

Returns

bool —

True if the name is valid, False otherwise

create_default_folders()

create_default_folders() : mixed

Create all folders specified as default

Returns

mixed —

is_special_folder()

is_special_folder(mixed  $name) : mixed

Check if specified folder is a special folder

Parameters

mixed $name

Returns

mixed —

get_special_folders()

get_special_folders(mixed  $forced = false) : mixed

Detect special folder associations stored in storage backend

Parameters

mixed $forced

Returns

mixed —

set_special_folders()

set_special_folders(mixed  $specials) : mixed

Set special folder associations stored in storage backend

Parameters

mixed $specials

Returns

mixed —

get_quota()

get_quota(string  $folder = null) : mixed

Get mailbox quota information

Parameters

string $folder

Folder name

Returns

mixed —

Quota info or False if not supported

set_acl()

set_acl(string  $folder, string  $user, string  $acl) : bool

Changes the ACL on the specified folder (SETACL)

Parameters

string $folder

Folder name

string $user

User name

string $acl

ACL string

Returns

bool —

True on success, False on failure

delete_acl()

delete_acl(string  $folder, string  $user) : bool

Removes any <identifier,rights> pair for the specified user from the ACL for the specified folder (DELETEACL)

Parameters

string $folder

Folder name

string $user

User name

Returns

bool —

True on success, False on failure

get_acl()

get_acl(string  $folder) : array

Returns the access control list for folder (GETACL)

Parameters

string $folder

Folder name

Returns

array —

User-rights array on success, NULL on error

list_rights()

list_rights(string  $folder, string  $user) : array

Returns information about what rights can be granted to the user (identifier) in the ACL for the folder (LISTRIGHTS)

Parameters

string $folder

Folder name

string $user

User name

Returns

array —

List of user rights

my_rights()

my_rights(string  $folder) : array

Returns the set of rights that the current user has to folder (MYRIGHTS)

Parameters

string $folder

Folder name

Returns

array —

MYRIGHTS response on success, NULL on error

set_metadata()

set_metadata(string  $folder, array  $entries) : bool

Sets IMAP metadata/annotations (SETMETADATA/SETANNOTATION)

Parameters

string $folder

Folder name (empty for server metadata)

array $entries

Entry-value array (use NULL value as NIL)

Returns

bool —

True on success, False on failure

delete_metadata()

delete_metadata(string  $folder, array  $entries) : bool

Unsets IMAP metadata/annotations (SETMETADATA/SETANNOTATION)

Parameters

string $folder

Folder name (empty for server metadata)

array $entries

Entry names array

Returns

bool —

True on success, False on failure

get_metadata()

get_metadata(string  $folder, array  $entries, array  $options = [], bool  $force = false) : array

Returns IMAP metadata/annotations (GETMETADATA/GETANNOTATION)

Parameters

string $folder

Folder name (empty for server metadata)

array $entries

Entries

array $options

Command options (with MAXSIZE and DEPTH keys)

bool $force

Disables cache use

Returns

array —

Metadata entry-value hash array on success, NULL on error

clear_cache()

clear_cache(string  $key = null, bool  $prefix_mode = false) : mixed

Clears the cache.

Parameters

string $key

Cache key name or pattern

bool $prefix_mode

Enable it to clear all keys starting with prefix specified in $key

Returns

mixed —

get_cache()

get_cache(string  $key) : mixed

Returns cached value

Parameters

string $key

Cache key

Returns

mixed —

cache_gc()

cache_gc() : mixed

Delete outdated cache entries

Returns

mixed —

__construct()

__construct() : mixed

Object constructor.

Returns

mixed —

__get()

__get(mixed  $name) : mixed

Magic getter for backward compat.

Parameters

mixed $name

Returns

mixed —

get_permflags()

get_permflags(string  $folder) : array

Returns PERMANENTFLAGS of the specified folder

Parameters

string $folder

Folder name

Returns

array —

Flags

get_vendor()

get_vendor() : string

Returns IMAP server vendor name

Returns

string —

Vendor name

threads()

threads(string  $folder) : \rcube_result_thread

Method for fetching threads data

Parameters

string $folder

Folder name

Returns

\rcube_result_thread —

Thread data object

threads_direct()

threads_direct(string  $folder) : \rcube_result_thread

Method for direct fetching of threads data

Parameters

string $folder

Folder name

Returns

\rcube_result_thread —

Thread data object

fetch_headers()

fetch_headers(string  $folder, array  $msgs, bool  $sort = true, bool  $force = false) : array

Fetches messages headers (by UID)

Parameters

string $folder

Folder name

array $msgs

Message UIDs

bool $sort

Enables result sorting by $msgs

bool $force

Disables cache use

Returns

array —

Messages headers indexed by UID

index_direct()

index_direct(string  $folder, string  $sort_field = null, string  $sort_order = null, mixed  $search = null) : \rcube_result_index

Return sorted list of message UIDs ignoring current search settings.

Doesn't uses cache by default.

Parameters

string $folder

Folder to get index from

string $sort_field

Sort column

string $sort_order

Sort order [ASC, DESC]

mixed $search

Returns

\rcube_result_index —

Sorted list of message UIDs

thread_index()

thread_index(string  $folder = '', string  $sort_field = null, string  $sort_order = null) : \rcube_result_thread

Return index of threaded message UIDs

Parameters

string $folder

Folder to get index from

string $sort_field

Sort column

string $sort_order

Sort order [ASC, DESC]

Returns

\rcube_result_thread —

Message UIDs

convert_criteria()

convert_criteria(string  $str, string  $charset, string  $dest_charset = 'US-ASCII') : string

Converts charset of search criteria string

Parameters

string $str

Search string

string $charset

Original charset

string $dest_charset

Destination charset (default US-ASCII)

Returns

string —

Search string

list_folders_subscribed_direct()

list_folders_subscribed_direct(string  $root = '', string  $name = '*') : array

Method for direct folders listing (LSUB)

Parameters

string $root

Optional root folder

string $name

Optional name pattern

Returns

array —

List of subscribed folders

list_folders_direct()

list_folders_direct(string  $root = '', string  $name = '*') : array

Method for direct folders listing (LIST)

Parameters

string $root

Optional root folder

string $name

Optional name pattern

Returns

array —

List of folders

set_caching()

set_caching(string  $type) : mixed

Enable or disable indexes caching

Parameters

string $type

Cache type (@see rcube::get_cache)

Returns

mixed —

update_cache()

update_cache(string  $key, mixed  $data) : mixed

Update cache

Parameters

string $key

Cache key

mixed $data

Data

Returns

mixed —

set_messages_caching()

set_messages_caching(bool  $set, int  $mode = null) : mixed

Enable or disable messages caching

Parameters

bool $set

Flag

int $mode

Cache mode

Returns

mixed —

sort_folder_list()

sort_folder_list(array  $a_folders, bool  $skip_special = false) : array

Sort folders in alphabetical order. Optionally put special folders first and other-users/shared namespaces last.

Parameters

array $a_folders

Folders list

bool $skip_special

Skip special folders handling

Returns

array —

Sorted list

id2uid()

id2uid(int  $id, string  $folder = null) : int

Find UID of the specified message sequence ID

Parameters

int $id

Message (sequence) ID

string $folder

Folder name

Returns

int —

Message UID

debug_handler()

debug_handler(mixed  $imap, mixed  $message) : mixed

This is our own debug handler for the IMAP connection

Parameters

mixed $imap
mixed $message

Returns

mixed —

parse_uids()

parse_uids(mixed  $uids) : array

Parse message UIDs input

Parameters

mixed $uids

UIDs array or comma-separated list or '' or '1:'

Returns

array —

Two elements array with UIDs converted to list and ALL flag

set_env()

set_env() : mixed

Sets delimiter and namespaces

Returns

mixed —

countmessages()

countmessages(string  $folder, string  $mode = 'ALL', bool  $force = false, bool  $status = true, bool  $no_search = false) : int

Protected method for getting number of messages

Parameters

string $folder

Folder name

string $mode

Mode for count [ALL|THREADS|UNSEEN|RECENT|EXISTS]

bool $force

Force reading from server and update cache

bool $status

Enables storing folder status info (max UID/count), required for folder_status()

bool $no_search

Ignore current search result

Returns

int —

Number of messages

_list_messages()

_list_messages(string  $folder = '', int  $page = null, string  $sort_field = null, string  $sort_order = null, int  $slice) : array

protected method for listing message headers

Parameters

string $folder

Folder name

int $page

Current page to list

string $sort_field

Header field to sort by

string $sort_order

Sort order [ASC|DESC]

int $slice

Number of slice items to extract from result array

Returns

array —

Indexed array with message header objects

list_thread_messages()

list_thread_messages(string  $folder, int  $page, int  $slice) : array

protected method for listing message headers using threads

Parameters

string $folder

Folder name

int $page

Current page to list

int $slice

Number of slice items to extract from result array

Returns

array —

Indexed array with message header objects

fetch_thread_headers()

fetch_thread_headers(string  $folder, \rcube_result_thread  $threads, int  $page, int  $slice) : array

protected method for fetching threaded messages headers

Parameters

string $folder

Folder name

\rcube_result_thread $threads

Threads data object

int $page

List page number

int $slice

Number of threads to slice

Returns

array —

Messages headers

set_thread_flags()

set_thread_flags(array  $headers, \rcube_result_thread  $threads) : array

protected method for setting threaded messages flags: depth, has_children, unread_children, flagged_children

Parameters

array $headers

Reference to headers array indexed by message UID

\rcube_result_thread $threads

Threads data object

Returns

array —

Message headers array indexed by message UID

list_search_messages()

list_search_messages(string  $folder, int  $page, int  $slice) : array

A protected method for listing a set of message headers (search results)

Parameters

string $folder

Folder name

int $page

Current page to list

int $slice

Number of slice items to extract from the result array

Returns

array —

Indexed array with message header objects

list_search_thread_messages()

list_search_thread_messages(string  $folder, int  $page, int  $slice) : array

protected method for listing a set of threaded message headers (search results)

Parameters

string $folder

Folder name

int $page

Current page to list

int $slice

Number of slice items to extract from result array

Returns

array —

Indexed array with message header objects

set_folder_stats()

set_folder_stats(string  $folder, string  $name, mixed  $data) : mixed

Stores folder statistic data in session

Parameters

string $folder

Folder name

string $name

Data name

mixed $data

Data value

Returns

mixed —

get_folder_stats()

get_folder_stats(string  $folder) : array

Gets folder statistic data

Parameters

string $folder

Folder name

Returns

array —

Stats data

sort_threads()

sort_threads(\rcube_result_thread  $threads) : mixed

Sort threaded result, using THREAD=REFS method if available.

If not, use any method and re-sort the result in THREAD=REFS way.

Parameters

\rcube_result_thread $threads

Threads result set

Returns

mixed —

search_index()

search_index(string  $folder, string  $criteria = 'ALL', string  $charset = null, string  $sort_field = null) : \rcube_result_index|\rcube_result_thread

protected search method

Parameters

string $folder

Folder name

string $criteria

Search criteria

string $charset

Charset

string $sort_field

Sorting field

Returns

\rcube_result_index|\rcube_result_thread —

Search results (UIDs)

set_search_dirty()

set_search_dirty(mixed  $folder) : mixed

Flag certain result subsets as 'incomplete'.

For subsequent refresh_search() calls to only refresh the updated parts.

Parameters

mixed $folder

Returns

mixed —

structure_part()

structure_part(array  $part, int  $count, string  $parent = '', mixed  $mime_headers = null) : mixed

Build message part object

Parameters

array $part
int $count
string $parent
mixed $mime_headers

Returns

mixed —

set_part_filename()

set_part_filename(\rcube_message_part  $part, string  $headers = null) : mixed

Set attachment filename from message part structure

Parameters

\rcube_message_part $part

Part object

string $headers

Part's raw headers

Returns

mixed —

structure_charset()

structure_charset(array  $structure) : string

Get charset name from message structure (first part)

Parameters

array $structure

Message structure

Returns

string —

Charset name

list_folders_filter()

list_folders_filter(mixed  $result, mixed  $root, mixed  $update_type = null) : mixed

Apply configured filters on folders list

Parameters

mixed $result
mixed $root
mixed $update_type

Returns

mixed —

list_folders_update()

list_folders_update(array  $result, string  $type = null) : mixed

Fix folders list by adding folders from other namespaces.

Needed on some servers e.g. Courier IMAP

Parameters

array $result

Reference to folders list

string $type

Listing type (ext-subscribed, subscribed or all)

Returns

mixed —

filter_rights()

filter_rights(mixed  $a_folders, mixed  $rights) : mixed

Filter the given list of folders according to access rights

For performance reasons we assume user has full rights on all personal folders.

Parameters

mixed $a_folders
mixed $rights

Returns

mixed —

get_fetch_headers()

get_fetch_headers() : string

Get message header names for rcube_imap_generic::fetchHeader(s)

Returns

string —

Space-separated list of header names

md2annotate()

md2annotate(string  $entry) : array

Converts the METADATA extension entry name into the correct entry-attrib names for older ANNOTATEMORE version.

Parameters

string $entry

Entry name

Returns

array —

Entry-attribute list, NULL if not supported (?)

get_cache_engine()

get_cache_engine() : mixed

Getter for IMAP cache object

Returns

mixed —

get_mcache_engine()

get_mcache_engine() : mixed

Getter for messages cache object

Returns

mixed —

clear_message_cache()

clear_message_cache(string  $folder = null, array  $uids = null) : mixed

Clears the messages cache.

Parameters

string $folder

Folder name

array $uids

Optional message UIDs to remove from cache

Returns

mixed —

detect_dual_use_folders()

detect_dual_use_folders() : bool

Determines if server supports dual use folders (those can contain both sub-folders and messages).

Returns

bool —

set_sort_order()

set_sort_order(string  $sort_field, string  $sort_order) : mixed

Validate the given input and save to local properties

Parameters

string $sort_field

Sort column

string $sort_order

Sort order

Returns

mixed —

sort_folder_specials()

sort_folder_specials(mixed  $folder, mixed  $list, mixed  $specials, mixed  $out) : mixed

Recursive function to put subfolders of special folders in place

Parameters

mixed $folder
mixed $list
mixed $specials
mixed $out

Returns

mixed —

sort_folder_comparator()

sort_folder_comparator(mixed  $str1, mixed  $str2) : mixed

Callback for uasort() that implements correct locale-aware case-sensitive sorting

Parameters

mixed $str1
mixed $str2

Returns

mixed —

change_subscription()

change_subscription(mixed  $folders, mixed  $mode) : mixed

Subscribe/unsubscribe a list of folders and update local cache

Parameters

mixed $folders
mixed $mode

Returns

mixed —

set_messagecount()

set_messagecount(mixed  $folder, mixed  $mode, mixed  $increment) : mixed

Increase/decrease messagecount for a specific folder

Parameters

mixed $folder
mixed $mode
mixed $increment

Returns

mixed —

clear_messagecount()

clear_messagecount(mixed  $folder, mixed  $mode = []) : mixed

Remove messagecount of a specific folder from cache

Parameters

mixed $folder
mixed $mode

Returns

mixed —

date_format()

date_format(mixed  $date) : mixed

Converts date string/object into IMAP date/time format

Parameters

mixed $date

Returns

mixed —

save_conn_state()

save_conn_state() : array

Remember state of the IMAP connection (last IMAP command).

Use e.g. if you want to execute more commands and ignore results of these.

Returns

array —

Connection state

restore_conn_state()

restore_conn_state(array  $state) : mixed

Restore saved connection state.

Parameters

array $state

Connection result

Returns

mixed —